﻿using System;
using Dsl.Ped.Framework.Exceptions;
using Dsl.Ped.Framework.Common;
using NUnit.Framework;

namespace DSLPedFrameworkTest.Projection.Common
{
    [TestFixture]
    public class ProjectionContainerTest
    {
        [SetUp]
        public void SetUp()
        {
        }

        [Test, Description("Check it doesn't crash when adding the projection")]
        public void RegisterProjectionTest1()
        {
            var projectionContainer = new ProjectionContainer("test");
            projectionContainer.RegisterProjection("testProjection", null);
        }

        [Test]
        public void RegisterProjectionTest2()
        {
            var projectionContainer = new ProjectionContainer("test");
            projectionContainer.RegisterProjection("test", null);
            try
            {
                projectionContainer.RegisterProjection("test", null);

                throw new Exception("Registration has been successfull, even when registering the same name twice, what is wrong!");
            }
            catch (ProjectionAlreadyRegisteredException exc)
            {
                // No need to do anything, we've expected the exception
            }
        }
    }
}
